import purchaseApi from "@/api/declaration/erp/purchaseApi"
import httpRequest from "@/config/axios/httpRequest"
import { PurchaseReturnModel } from "@/models/erp/PurchaseReturnModel"


// ERP 采购退货 API
export const PurchaseReturnApi = {
  // 查询采购退货分页
  getPurchaseReturnPage: async (params: any) => {
    return await httpRequest.get(purchaseApi.GetPurchaseReturnPage, params)
  },

  // 查询采购退货详情
  getPurchaseReturn: async (id: number) => {
    return await httpRequest.get(purchaseApi.GetPurchaseReturn, { params: { id} })
  },

  // 新增采购退货
  createPurchaseReturn: async (data: PurchaseReturnModel) => {
    return await httpRequest.post(purchaseApi.CreatePurchaseReturn, data)
  },

  // 修改采购退货
  updatePurchaseReturn: async (data: PurchaseReturnModel) => {
    return await httpRequest.put(purchaseApi.UpdatePurchaseReturn, data)
  },

  // 更新采购退货的状态
  updatePurchaseReturnStatus: async (id: number, status: number) => {
    return await httpRequest.put(purchaseApi.UpdatePurchaseReturnStatus, { id, status })
  },

  // 删除采购退货
  deletePurchaseReturn: async (ids: number[]) => {
    return await httpRequest.delete(purchaseApi.DeletePurchaseReturn, { params: { ids } })
  },

  // 导出采购退货 Excel
  exportPurchaseReturn: async (params: any) => {
    return await httpRequest.download(purchaseApi.ExportPurchaseReturn, params)
  }
}
